<?php
if (have_posts())
    while (have_posts()) : the_post();
        global $post_id;
        ?>
        <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
            <div class="in-sec row">
                <div class="blog-detail detail-page">
                    <?php
                    $image_id = get_post_thumbnail_id($post->ID);
                    if ($image_id <> '') {
                        //$image_url = wp_get_attachment_image_src($image_id, array(580,244),true);
                        $image_url = cs_attachment_image_src($image_id, 580, 244);
                        ?>
                        <a class="thumb" style="width:100%; margin-bottom:20px;">
                            <?php
                            // getting featured image start
                            echo "<img src='" . $image_url . "' />";
                            // getting featured image end
                            ?>
                        </a>
        <?php } ?>
                    <div class="blog-opts">
                        <div class="date">
                            <h1><?php echo get_the_date(); ?></h1>
                        </div>
                        <div class="desc">
                            <h4><?php echo get_the_title(); ?></h4>
                            <p class="by">Posted by <a href="<?php echo get_author_posts_url(get_the_author_meta('ID')); ?>"><?php echo get_the_author(); ?></a></p>
                            <p class="coments"><a href="<?php echo get_permalink(); ?>#comments"><?php echo get_comments_number($post_id); ?> Comments</a></p>
                                <?php $tag_post = wp_get_post_tags($post->ID); ?>
                            <p class="tags">
                                <?php
                                $counterr = 0;
                                foreach ($tag_post as $values) {
                                    if ($counterr == 0) {
                                        echo 'Tag:  ';
                                    }
                                    $counterr++;
                                    echo '<a href="' . get_term_link($values->slug, $values->taxonomy) . '">' . $values->name . '</a>  ';
                                }
                                ?> 
                            </p>
                            <div class="clear"></div>
                        </div>
                    </div>
                    <div class="blog-desc">
        <?php the_content(); ?>
                            <?php wp_link_pages(array('before' => '<div class="page-link">' . __('Pages:', 'PixFill'), 'after' => '</div>')); ?>
                    </div>
                    <div class="blog-sharing">
                        <div class="sharing right">
                            <?php
                            $audio_social_share = '';
                            $cs_audio = get_post_meta($post->ID, "cs_audio", true);
                            if ($cs_audio <> "") {
                                $xmlObject = new SimpleXMLElement($cs_audio);
                                $audio_social_share = $xmlObject->audio_social_share;
                            }
                            if ($audio_social_share == "Yes") {
                                $cs_social_share = get_option("cs_social_share");
                                $xmlObject_album = new SimpleXMLElement($cs_social_share);
                                $twitter = $xmlObject_album->twitter;
                                $facebook = $xmlObject_album->facebook;
                                $linkedin = $xmlObject_album->linkedin;
                                $digg = $xmlObject_album->digg;
                                $delicious = $xmlObject_album->delicious;
                                $google_plus = $xmlObject_album->google_plus;
                                $google_buzz = $xmlObject_album->google_buzz;
                                $google_bookmark = $xmlObject_album->google_bookmark;
                                $myspace = $xmlObject_album->myspace;
                                $reddit = $xmlObject_album->reddit;
                                $stumbleupon = $xmlObject_album->stumbleupon;
                                $yahoo_buzz = $xmlObject_album->yahoo_buzz;
                                $rss = $xmlObject_album->rss;
                                if ($twitter == 'on' or $facebook == 'on' or $linkedin == 'on' or $digg == 'on' or $delicious == 'on' or $google_plus == 'on' or $google_buzz == 'on' or $google_bookmark == 'on' or $myspace == 'on' or $reddit == 'on' or $stumbleupon == 'on' or $yahoo_buzz == 'on' or $rss == 'on') {
                                    $pageurl = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
                                    ?>
                                    <h6>Share This Post</h6>
                                    <?php if ($twitter == 'on') { ?><a href="http://twitter.com/home?status=<?php the_title(); ?> - <?php echo $pageurl; ?>" target="_blank"><img src="<?php echo get_template_directory_uri(); ?>/images/admin/twitter.png" alt="" /></a><?php } ?>
                                    <?php if ($facebook == 'on') { ?><a href="http://www.facebook.com/share.php?u=<?php the_title(); ?>" target="_blank"><img src="<?php echo get_template_directory_uri(); ?>/images/admin/facebook.png" alt="" /></a><?php } ?>
                                    <?php if ($linkedin == 'on') { ?><a href="http://www.linkedin.com/shareArticle?mini=true&#038;url=<?php echo $pageurl; ?>&#038;title=<?php the_title(); ?>" target="_blank"><img src="<?php echo get_template_directory_uri(); ?>/images/admin/linkedin.png" alt="" /></a><?php } ?>
                                    <?php if ($digg == 'on') { ?><a href="http://digg.com/submit?url=<?php echo $pageurl; ?>&#038;title=<?php the_title(); ?>" target="_blank"><img src="<?php echo get_template_directory_uri(); ?>/images/admin/digg.png" alt="" /></a><?php } ?>												
                                    <?php if ($delicious == 'on') { ?><a href="http://delicious.com/post?url=<?php echo $pageurl; ?>&#038;title=<?php the_title(); ?>" target="_blank"><img src="<?php echo get_template_directory_uri(); ?>/images/admin/delicious.png" alt="" /></a><?php } ?>
                                    <?php if ($google_bookmark == 'on') { ?><a href="http://www.google.com/bookmarks/mark?op=edit&#038;bkmk=<?php echo $pageurl; ?>&#038;title=<?php the_title(); ?>" target="_blank"><img src="<?php echo get_template_directory_uri(); ?>/images/admin/google_bookmark.png" alt="" /></a><?php } ?>
                                    <?php if ($google_buzz == 'on') { ?><a href="http://www.google.com/reader/link?title=<?php the_title(); ?>&url=<?php the_permalink(); ?>" target="_blank"><img src="<?php echo get_template_directory_uri(); ?>/images/admin/google_buzz.png" alt="" /></a><?php } ?>												
                                    <?php if ($google_plus == 'on') { ?><a href="https://plus.google.com/share?url=<?php the_permalink(); ?>" target="_blank"><img src="<?php echo get_template_directory_uri(); ?>/images/admin/google_plus.png" alt="" /></a><?php } ?>																																																
                                    <?php if ($myspace == 'on') { ?><a href="http://www.myspace.com/Modules/PostTo/Pages/?u=<?php echo $pageurl; ?>" target="_blank"><img src="<?php echo get_template_directory_uri(); ?>/images/admin/myspace.png" alt="" /></a><?php } ?>
                                    <?php if ($reddit == 'on') { ?><a href="http://reddit.com/submit?url=<?php echo $pageurl; ?>&#038;title=<?php the_title(); ?>" target="_blank"><img src="<?php echo get_template_directory_uri(); ?>/images/admin/reddit.png" alt="" /></a><?php } ?>
                                    <?php if ($stumbleupon == 'on') { ?><a href="http://www.stumbleupon.com/submit?url=<?php echo $pageurl; ?>&#038;title=<?php the_title(); ?>" target="_blank"><img src="<?php echo get_template_directory_uri(); ?>/images/admin/stumbleupon.png" alt="" /></a><?php } ?>
                <?php if ($yahoo_buzz == 'on') { ?><a href="#" target="_blank"><img src="<?php echo get_template_directory_uri(); ?>/images/admin/yahoo_buzz.png" alt="" /></a><?php } ?>                                                                                                                                
                <?php if ($rss == 'on') { ?><a href="#" target="_blank"><img src="<?php echo get_template_directory_uri(); ?>/images/admin/rss.png" alt="" /></a><?php } ?>												
            <?php } ?>
        <?php } ?>
                        </div>
                        <div class="clear"></div>
                    </div>
                    <div class="clear"></div>
                </div>
                <div class="clear"></div>
            </div>
            <div class="clear"></div>

                         <?php if ( get_the_author_meta( 'description' ) ) :?>
                                <div class="in-sec" style="margin-top:20px;">
                                    <div class="about-author">
                                        <div class="avatars">
                                            <?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'PixFill_author_bio_avatar_size', 53 ) ); ?>
                                        </div>
                                        <div class="desc">
                                            <h5><a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>">About <?php echo get_the_author(); ?></a></h5>
                                            <p class="txt">
                                                <?php the_author_meta( 'description' ); ?>
                                            </p>
                                            <div class="clear"></div>
                                        </div>
                                        <div class="clear"></div>
                                    </div>
                                </div>
                                <?php endif; ?>
                                <?php comments_template( '', true ); ?>
                            </div>
    <?php endwhile; // end of the loop.  ?>
        <div class="clear"></div>       
           